/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrn.engcomp.observer;

/**
 *
 * @author allan
 */
public class LinearObserver extends Observer {

    public LinearObserver(double L1, double L2) {
        super();
        setV1(L1);
        setV2(L2);
    }

    @Override
    public void calcularObservador(double saida) {

        setDeltaX((getAd()[0][0] * getDeltaX1() + getBd()[0][0] * getDeltaU() + getV1() * (saida - getYeq() - getDeltaX2())),
                (getAd()[1][0] * getDeltaX1() + getAd()[1][1] * getDeltaX2() + getBd()[1][0] * getDeltaU() + getV2() * (saida - getYeq() - getDeltaX2())));

        setXck(getXeq1() + getDeltaX1(), getXeq2() + getDeltaX2());

        //setErro(nivelTanque1 - getXck1(), saida - getXck2());
    }

    @Override
    public void run(double nivelTanque2) {
//        if (nivelTanque2 >= 14.8) {
            calcularObservador(nivelTanque2);
//        }
    }
}
